﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace CommonLib {
    public struct Ray {
        private static int fountain = 0;

        public Vector3c position, direction;
        public int hashcode;

        public Ray(Vector3c pos, Vector3c dir) {
            this.position = pos;
            this.direction = dir;
            this.direction.normalize();
            this.hashcode = System.Threading.Interlocked.Increment(ref fountain);
        }
        public Ray(Vector3c pos, Vector3c dir, double distance) {
            this.position = pos;
            this.direction = dir;
            this.direction.div(distance);
            this.hashcode = System.Threading.Interlocked.Increment(ref fountain);
        }
        public void Set(Vector3c pos, Vector3c dir) {
            position = pos;
            direction = dir;
        }
    }
}
